<?php

use yii\db\Schema;
use yii\db\Migration;

class m150521_081408_add_shaking_creative_template extends Migration
{
    public function up()
    {
        $sql = <<<FINE
    insert into {{%creative_template}} (name, code) values ('晃动动画模板', '<div class="vam_ad_container" style="position: relative; display: inline-block; border: none; padding: 0px; margin: 0px; visibility: visible; overflow: hidden;"><img src="{!dsp_show_url}" style="display:none;" /><script type="text/javascript" charset="utf-8">vam_creative_id = "{!dsp_creative_id}";vam_creative_type = "{!dsp_creative_type}";vam_creative_width = "{!dsp_creative_width}";vam_creative_height = "{!dsp_creative_height}";vam_creative_material = "{!dsp_creative_material}";vam_creative_click = "{!vam_click_url}{!dsp_click_url}{!dsp_creative_monitor}{!dsp_creative_landingpage}";vam_creative_impr = "{!dsp_creative_impr}";vam_creative_logo = "{!dsp_creative_logo}";vam_creative_animation = "1"; </script><script type="text/javascript" charset="utf-8" src="{!dsp_cdn_url}/vam_dsp.min.js"></script></div>');
    update {{%creative_template}} set code = '<div class="vam_ad_container" style="position: relative; display: inline-block; border: none; padding: 0px; margin: 0px; visibility: visible; overflow: hidden;"><img src="{!dsp_show_url}" style="display:none;" /><script type="text/javascript" charset="utf-8">vam_creative_id = "{!dsp_creative_id}";vam_creative_type = "{!dsp_creative_type}";vam_creative_width = "{!dsp_creative_width}";vam_creative_height = "{!dsp_creative_height}";vam_creative_material = "{!dsp_creative_material}";vam_creative_click = "{!vam_click_url}{!dsp_click_url}{!dsp_creative_monitor}{!dsp_creative_landingpage}";vam_creative_impr = "{!dsp_creative_impr}";vam_creative_logo = "{!dsp_creative_logo}"; </script><script type="text/javascript" charset="utf-8" src="{!dsp_cdn_url}/vam_dsp.min.js"></script></div>' where id=1;
FINE;
        return $this->execute($sql);
    }

    public function down()
    {
        $sql = <<<FINE
    TRUNCATE TABLE {{%creative_template}};
    INSERT INTO {{%creative_template}} (name, code) values
('系统模板', '<img src="{!dsp_show_url}" style="display:none;" /><script type="text/javascript" charset="utf-8">vam_creative_id = "{!dsp_creative_id}";vam_creative_type = "{!dsp_creative_type}";vam_creative_width = "{!dsp_creative_width}";vam_creative_height = "{!dsp_creative_height}";vam_creative_material = "{!dsp_creative_material}";vam_creative_click = "{!vam_click_url}{!dsp_click_url}{!dsp_creative_monitor}{!dsp_creative_landingpage}";vam_creative_impr = "{!dsp_creative_impr}";vam_creative_logo = "{!dsp_creative_logo}"; </script><script type="text/javascript" charset="utf-8" src="{!dsp_cdn_url}/vam_dsp.min.js"></script>');
FINE;
        $this->execute($sql);
        return true;
    }
}
